﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Common;
using System.Collections;

namespace PassportManage
{
    public partial class Form_SystemLog : Form
    {
        public Form_SystemLog()
        {
            InitializeComponent();
            BLL.LogOP.SetLogTypeCombobox(comboBox1);
            comboBox1.SelectedValue = 0;
            dateTimePicker2.Value = DateTime.Now;
            dateTimePicker1.Value = DateTime.Now.AddDays(-7);
            WFNetLib.MyControls.ToolStripDateTimePicker startDateTimePicker = new WFNetLib.MyControls.ToolStripDateTimePicker(DateTime.Now);
            startDateTimePicker.Control.Width = 120;
            toolStrip1.Items.Insert(13, startDateTimePicker);
            WFNetLib.MyControls.ToolStripDateTimePicker endDateTimePicker = new WFNetLib.MyControls.ToolStripDateTimePicker(DateTime.Now.AddDays(-7));
            endDateTimePicker.Control.Width = 120;
            toolStrip1.Items.Insert(15, endDateTimePicker);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int[] logTypes;
            if ((int)comboBox1.SelectedValue == 0)
            {
                ArrayList logShow = (ArrayList)comboBox1.DataSource;
                if(logShow.Count==1)
                    return;
                logTypes=new int[logShow.Count-1];
                for (int i = 1; i < logShow.Count; i++)
                {
                    logTypes[i - 1] = ((BLL.LogTypeForCombobox)logShow[i]).LogTypeValue;
                }
            }
            else
            {
                logTypes = new int[1];
                logTypes[0] = (int)comboBox1.SelectedValue;
            }
//             DataTable dt = WFNetLib.Log.LogSQL.Select(logTypes,textBox1.Text,comboBox2.Text,dateTimePicker1.Value,dateTimePicker2.Value,textBox2.Text);
//             dataGridView1.DataSource = dt;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            DataTable dt = null;
            dataGridView1.DataSource = dt;
        }
        private void DataShowPreProc(ref DataTable dt)
        {

        }

        private void dataGridView1_ColumnAdded(object sender, DataGridViewColumnEventArgs e)
        {
            //e.Column.HeaderText = WFNetLib.Log.LogInfo.GetColumnName(e.Column.HeaderText);
        }
    }
}
